package com.rightsidetech.system.dtos.request.news;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
public class NewsSaveReq implements Serializable {

    @ApiModelProperty(value = "标题", required = true)
    @NotBlank(message = "标题不可为空")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5a-zA-Z0-9-./()（）【】\"！？“”、。+ —｛｝~`!?%$#@*:;：；_\\s\\S ]{0,}$", message = "标题不支持特殊字符")
    @Length(max = 100,message = "标题长度过长")
    private String topic;

    @ApiModelProperty(value = "发布平台 1-代理商app 2-门店app 3全部", required = true)
    @Range(min = 1,max = 3,message = "发布平台不正确")
    @NotNull(message = "发布平台不可为空")
    private Byte platform;

    @ApiModelProperty(value = "新闻分类id",required = true)
    @NotNull(message = "新闻分类id不能为空")
    @Min(value = 1,message = "分类id不可小于1")
    private Long typeId;

    @ApiModelProperty("描述")
    @Length(max = 1500,message = "描述最大长度为1500")
    @Pattern(regexp = "^$|[\\u4e00-\\u9fa5a-zA-Z0-9_!@#$%^&*?.,:;，。！？、 ：【】{}()（）<>/《》…￥\\s\\S ]{0,}", message = "描述不能输入特殊字符")
    private String describe;

    @ApiModelProperty(value = "新闻发布时间 yyyy-MM-dd",required = true)
    @NotNull(message = "新闻发布时间不可为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date releaseDate;


    @ApiModelProperty("文件 (图片/视频)")
//    @NotEmpty(message = "文件不可为空")
    @Size(max = 9,message = "文件最多上传9个")
    private List<FileUriType> file;

}
